// 基础响应类型
export interface BaseResponse<T = any> {
  code: number
  message: string
  data: T
}

// 分页响应类型
export interface PaginationResponse<T = any> {
  code: number
  message: string
  data: {
    total: number
    list: T[]
  }
}

// 用户类型
export interface User {
  id: number | string
  name: string
  age: number
  avatar: string
  email: string
  phone: string
  status: 'active' | 'inactive' | 'pending'
  createTime: string
  address: string
  role: 'admin' | 'editor' | 'user'
  description?: string
  lastLoginTime?: string
  department?: string
}

// 产品类型
export interface Product {
  id: number
  name: string
  price: number
  originalPrice: number
  stock: number
  sales: number
  status: 'on' | 'off'
  coverImage: string
  images: string[]
  category: string
  description: string
  createTime: string
}

// 订单类型
export interface Order {
  id: string
  userId: number
  totalAmount: number
  status: 'pending' | 'paid' | 'shipped' | 'delivered' | 'cancelled'
  createTime: string
  payTime: string
  productCount: number
  address: {
    receiver: string
    phone: string
    province: string
    city: string
    district: string
    detail: string
  }
}

// 分类类型
export interface Category {
  id: number
  name: string
  parentId: number
  sort: number
  level: number
  createTime: string
  children?: Category[]
}

// 登录请求类型
export interface LoginRequest {
  username: string
  password: string
}

// 登录响应数据类型
export interface LoginResponseData {
  token: string
  userInfo: Omit<User, 'age' | 'phone' | 'address'> & {
    permissions: string[]
  }
}

// 错误信息类型
export interface ErrorInfo {
  code: number
  message: string
  data: null
}